﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using yncTech.Common;
using yncTech.BusinessObjects;

public partial class Admin_FinMov_FinMov002a : AdminBasePage
{
    decimal shipID = -1;
    protected void Page_Load(object sender, EventArgs e)
    {
        if (Request.QueryString[FinShippingMetadata.ColumnNames.ShipID] != null)
        {
            shipID = decimal.Parse(Request.QueryString[FinShippingMetadata.ColumnNames.ShipID]);
        }

    }

    protected void btnSave_Click(object sender, EventArgs e)
    {
        try
        {
            FinShipping fs = new FinShipping();
            fs.LoadByPrimaryKey(shipID);
            if (drpFeedback.SelectedValue == "0")
            {
                fs.ShippingStatus = ConstantValue.ShippingStatusCode.Pending;
            }
            else if (drpFeedback.SelectedValue == "1")
            {
                fs.ToDestination = drpThunit.IntValue;
                fs.ShippingStatus = ConstantValue.ShippingStatusCode.Pending;
            }
            else
            {
                fs.Comments = txtComments.Text.Trim();
                fs.ShippingStatus = ConstantValue.ShippingStatusCode.Rejected;

            }
            fs.Replay = LoginUserInfo.CurrentUser.UserName;
            fs.ReplayDttm = DateTime.Now;
            fs.ReplayStatus = drpFeedback.Text;
            fs.UpdatedBy = LoginUserInfo.CurrentUser.UserName;
            fs.UpdatedDttm = DateTime.Now;
            fs.Save();

            WebHelper.CloseDialog(true);
        }
        catch (Exception ex)
        {
            lbMessage.Text = ex.Message;
        }
        

    }
}